//
//  QRCodeViewController.m
//  Weibo
//
//  Created by wpapple on 16/6/1.
//  Copyright © 2016年 红红火火恍恍惚惚嘿嘿嘿. All rights reserved.
//

#import "QRCodeViewController.h"

@interface QRCodeViewController ()

@property (weak, nonatomic) IBOutlet UIImageView *qrCodeScanLine;
@property (weak, nonatomic) IBOutlet UIImageView *qrCodeBoeder;
@property (strong , nonatomic) CADisplayLink * link;


@end

@implementation QRCodeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    CADisplayLink * link = [CADisplayLink displayLinkWithTarget:self selector:@selector(QRCodeScanlineWillMove)];
    [link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
    self.link = link;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)QRCodeScanlineWillMove{
    
    self.qrCodeScanLine.transform = CGAffineTransformTranslate(self.qrCodeScanLine.transform, 0, 3);
    if (self.qrCodeScanLine.transform.ty > self.qrCodeBoeder.height) {
        self.qrCodeScanLine.transform = CGAffineTransformIdentity;
    }
    
}


- (IBAction)CloseThisController:(UIBarButtonItem *)sender {
    
    [self.link invalidate];
    [self dismissViewControllerAnimated:YES completion:nil];
    
}

- (IBAction)touchAblumButton:(UIBarButtonItem *)sender {
    
    UIImagePickerController * imagePickerController = [[UIImagePickerController alloc]init];
    
    [self showViewController:imagePickerController sender:nil];
    
}


@end
